<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" style="height:100%">
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/css/layui.css}"  media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
    <script th:src="@{/layui.js}" charset="utf-8"></script>
    <script th:src="@{/echarts/echarts.min.js}" charset="utf-8"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>
<script type="text/javascript">
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var app = {};
    option = null;

    layui.use('layer',function () {
       var $=layui.jquery;
       $.get('/dataanaiysis/monthIncome',function (result) {
           console.log(result);
           var dates=new Array();
           var incomes=new Array();
           for (var i=0;i<result.length;i++){
               dates[i]=result[i].date;
               incomes[i]=result[i].income;
           }



           option = {
               xAxis: {
                   type: 'category',
                   data: dates
               },
               yAxis: {
                   type: 'value'
               },
               series: [{
                   data: incomes,
                   barWidth:20,//设置条宽度
                   type: 'bar',
                   showBackground: true,
                   backgroundStyle: {
                       color: 'rgba(220, 220, 220, 0.8)'
                   }
               }]
           };
           ;
           if (option && typeof option === "object") {
               myChart.setOption(option, true);
           }








       })
    });

</script>



</body>
</html>
